<?php
/*==========================================================================*\
| Project: 			VIETCMS CONTENT MANAGERMENT SYSTEM - ver 1.6  			 |
| Id: 				create_html.php (28-December-2007)						 |
| Author:			Nguyen Van Duc (+84)098 778 2349			             |
| E-mail:			info@vietcms.com - YahooID: vntux or rwduc 				 |
| Copyright:    	Copyright (c) 2007 VIETCMS INC. All rights reserved.     |
\*==========================================================================*/

//Create Categories
function create_topmenu($strMenu,$pathfile){
					
		$ft=fopen($pathfile,"w");	   		
		if(fwrite($ft,$strMenu))
			return true;
		else
			return false;
}
//Eof Create Categories

//Tao list OPTION cho the SELECT 
function create_option_tags($stSQL,$filehtm){
	global $db;
	$result = $db->query($stSQL);
    $totalRows=$db->numRows($result);
	$strOption="";
		if($totalRows>0)
		{
		  while ($row = $db->fetchNextObject ($result))
		   {
		      $strOption .="<option value=\"" ;
		      $strOption .=$row["No"]."\">";
		      $strOption .= $row["Name"];
			  $strOption .= "</option>";
		   }
		}	
		$pathfile ="../modules/html/".$filehtm;			
		$ft=fopen($pathfile,"w");	   		
		if(fwrite($ft,$strOption))
			return true;

		else
		return false;
}

function homelist($SQL,$pathfile){
	global $db;
	$result = $db->query($SQL);
	$totalRows=$db->numRows($result);
	$strList = "";
	if($totalRows>0){
		while($row = $db->fetchNextObject($result)){
		$cat=getC($row->catid);
		$strList .= '<li><a href="'.$cat->alias.'/'.$row->id.'-'.$row->alias.'.htm">'.cut_string($row->title,40,'...').'</a></li>';
		}
	}
	$ft=fopen($pathfile,"w");	   		
		if(fwrite($ft,$strList))
			return true;
		else
			return false;		
}
?>